using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace Cpsc481Phone.Gui.MissedEvents
{
    public partial class MissedEvent : UserControl
    {
        public int selectedRow = 0;

        private ArrayList list = new ArrayList(); 

        public MissedEvent()
        {
            InitializeComponent();
            list.Add(missedTxtEvent1);
            list.Add(missedTxtEvent2);
            list.Add(missedTxtEvent3);
            list.Add(missedTxtEvent4);
            missedTxtEvent1.setSelected(true);

            missedTxtEvent1.setMissedEvent(MissedEnum.Text, "Kyle", "hey how ar...");
            missedTxtEvent2.setMissedEvent(MissedEnum.Voice, "Kyle", "hey how ar...");
            missedTxtEvent3.setMissedEvent(MissedEnum.Call, "Kyle", "hey how ar...");
            missedTxtEvent4.setMissedEvent(MissedEnum.Text, "Kyle", "hey how ar...");

        }
        public void cursorDown()
        {
            if (selectedRow < list.Count && selectedRow>=0)
                selectedRow++;
            else
                selectedRow = 0;

            for (int i = 0; i < list.Count; i++)
            {
                MissedTxtEvent evt = (MissedTxtEvent)list[i];
                evt.setSelected(false);
            }

            if (selectedRow < list.Count)
            {
                MissedTxtEvent evte = (MissedTxtEvent)list[selectedRow];
                evte.setSelected(true);
            }

            
        }
        public void cursorUp()
        {
            if (selectedRow > 0 && selectedRow >= 0)
                selectedRow--;
            else
                selectedRow = list.Count;

            for (int i = 0; i < list.Count; i++)
            {
                MissedTxtEvent evt = (MissedTxtEvent)list[i];
                evt.setSelected(false);
            }
            if (selectedRow < list.Count)
            {
                MissedTxtEvent evte = (MissedTxtEvent)list[selectedRow];
                evte.setSelected(true);
            }
        }

        
    }
}
